Image processing apparatus having a thinning unit and a smoothing unit, and image processing method

ABSTRACT

An image processing apparatus includes a smoothing processing unit which performs smoothing processing, a thinning processing unit which performs thinning processing, an edge direction determination unit which determines an edge direction with respect to each pixel of the image data and a blending processing unit which decides a pixel value of each pixel of when the thinning processing and the smoothing processing are realized at same time. In the image processing apparatus, the blending processing unit decides a pixel value of a target pixel of when the thinning processing and the smoothing processing are realized at the same time depending on a combination of whether the thinning processing is performed or not and whether the smoothing processing is performed or not on the target pixel.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an image processing apparatus and animage processing method.

2. Description of Related Art

Thinning processing is known as an image processing. In thinningprocessing, sharpness of character and the like is improved bydecreasing the pixel values at the edges of the characters and the like.

Smoothing processing is another image processing to be performed onedges. In smoothing processing, edges of an oblique line portion can besmoothed visually by making the edges be halftone by increasing ordecreasing pixel values at the edges of the oblique line portion or acharacter and the like.

Both of thinning processing and smoothing processing are performed onedges. However, it has been difficult to perform the two processing atthe same time because the objects of the two processing are different.For example, although a sharp and smooth character can be obtained whenthinning processing is performed on straight line portions and smoothingprocessing is performed on oblique line portions of a character, it isdifficult to obtain such a character by a method of detecting structuresof the straight line portions and the oblique line portions andswitching between thinning processing and smoothing processing dependingon the detected structure (see Japanese Patent Application Laid OpenPublication No. H7-334672, for example). This is because there arepixels belonging to both straight line portion and the oblique lineportion, causing an unexpected result such as increase in pixel valuedue to smoothing processing although thinning, not smoothing, shouldhave been the appropriate processing.

In response to this, the applicant developed an image processingapparatus to realize thinning processing and smoothing processing at thesame time (see Japanese Patent No. JP 4225337, for example). Accordingto this image processing apparatus, results of smoothing processing andthinning processing are stored as change amounts from the original pixelvalue. When a pixel value obtained by adding the stored change amountsto the original pixel value exceeds that maximum value or becomes anegative value, the excess or shortfall is adjusted by using the pixelvalue of an adjacent pixel which has a predetermined positional relationwith the target pixel. By adjusting the processing results of thinningprocessing and smoothing processing not only in the target pixel by intwo pixels which the target pixel and an adjacent pixel thereof, the twoprocessing results can be absorbed reasonably.

According to the above described image processing apparatus, commontemplates are used in smoothing processing and thinning processing. Ineach template, the positional relation between the target pixel and anadjacent pixel to be used for adjusting the pixel value of the targetpixel is defined, and in addition, change amounts in pixel value due tosmoothing processing and thinning processing of each of the target pixeland the adjacent pixel are defined. A pair of target pixel and adjacentpixel, which are the pixels in which pixel value adjustment is to beperformed, is decided by carrying out template matching, and pixelvalues of the target pixel and the adjacent pixel when the twoprocessing are performed at the same time are obtained.

In such template method, thinning processing and smoothing processingare performed in a unified manner by using the templates. That is, thetemplates need to be newly prepared in order to switch between smoothingprocessing and thinning processing because there is no border betweenthinning processing and smoothing processing in the templates and thetwo processing are not independent from each other. Although theprocessing may be switched without newly preparing the templates, anappropriate processing result cannot be obtained because the judgmentcriteria of edges in each of thinning processing and smoothingprocessing differs from each other.

However, there are various processing methods in thinning processing andsmoothing processing, and it will be convenient if the processing can beswitched between each other.

SUMMARY OF THE INVENTION

It is, therefore, a main object of the present invention is to makethinning processing and smoothing processing independent from each otherwhen realizing the thinning processing and the smoothing processing atthe same time.

In order to achieve the above object, according to a first aspect of thepresent invention, there is provided an image processing apparatusincluding a smoothing processing unit which performs smoothingprocessing on image data, a thinning processing unit which performsthinning processing on the image data, an edge direction determinationunit which determines an edge direction with respect to each pixel ofthe image data and a blending processing unit which decides a pixelvalue of each pixel of when the thinning processing and the smoothingprocessing are realized at same time, and the blending processing unitdecides a pixel value of a target pixel of when the thinning processingand the smoothing processing are realized at the same time depending ona combination of whether the thinning processing is performed or not andwhether the smoothing processing is performed or not on the target pixelby using pixel values of the target pixel and a surrounding pixel of thetarget pixel, change amounts in pixel value due to the smoothingprocessing, change amounts in pixel value due to the thinning processingand the edge direction which is determined with respect to the targetpixel.

According to a second aspect of the present invention, there is providedan image processing method including smoothing of image data, thinningof the image data, determining an edge direction with respect to eachpixel of the image data; and blending to decide a pixel value of eachpixel of when the thinning processing and the smoothing processing arerealized at same time, and in the blending, a pixel value of a targetpixel of when the thinning processing and the smoothing processing arerealized at the same time is decided depending on a combination ofwhether the thinning processing is performed or not and whether thesmoothing processing is performed or not on the target pixel by usingpixel values of the target pixel and a surrounding pixel of the targetpixel, change amounts in pixel value due to the smoothing processing,change amounts in pixel value due to the thinning processing and theedge direction which is determined with respect to the target pixel.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will become more fully understood from thedetailed description given hereinafter and the appended drawings.However, these shall not limit the present invention, and wherein:

FIG. 1 is a configuration view of an image processing apparatusaccording to the embodiment;

FIG. 2 is a diagram showing a region of 7×7 pixels;

FIG. 3 is a configuration view of a smoothing processing unit;

FIG. 4 is an example of templates which are used for detecting a patternof an edge to be smoothed;

FIG. 5 is a configuration view of a thinning processing unit;

FIG. 6 is a determination example of an edge direction;

FIG. 7 is a determination example of an edge direction;

FIG. 8 is a determination example of an edge direction;

FIG. 9 is a configuration view of a blending processing unit;

FIG. 10 is a flowchart of processing performed by a classification unit;

FIG. 11 is a flowchart of processing performed by a pixel value decidingunit in case 1;

FIGS. 12A and 12B are diagrams illustrating an assumed positionalrelationship between a target pixel and a surrounding pixel thereof incase 1;

FIG. 13 is a flowchart of processing performed by the pixel valuedeciding unit in case 2;

FIGS. 14A and 14B are diagrams illustrating an assumed positionalrelationship between a target pixel and a surrounding pixel thereof incase 2;

FIG. 15 is a flowchart of processing performed by the pixel valuedeciding unit in case 3;

FIGS. 16A and 16B are diagrams illustrating an assumed positionalrelationship between a target pixel and a surrounding pixel thereof incase 3;

FIG. 17 is a flowchart of processing performed by the pixel valuedeciding unit in case 4;

FIGS. 18A and 18B are diagrams showing an assumed positionalrelationship between a target pixel and a surrounding pixel thereof incase 4;

FIG. 19A is an image diagram of processing performed by the blendingprocessing unit;

FIG. 19B is a diagram illustrating a processing result of the blendingprocessing unit;

FIG. 20A is a diagram illustrating an original image;

FIG. 20B is a diagram illustrating a desired image when thinningprocessing and smoothing processing are performed at the same time;

FIG. 20C is a diagram illustrating a processing result when onlysmoothing processing is performed on the original image;

FIG. 20D is a diagram illustrating a processing result when onlythinning processing is performed on the original image;

FIG. 20E is a diagram illustrating a processing result when processingis switched between smoothing processing and thinning processingdepending on the image structure; and

FIG. 20F is a diagram illustrating a processing result when a pixelvalue is adjusted to be smaller in smoothing processing.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

Hereinafter, an embodiment of an image processing apparatus and an imageprocessing method according to the present invention will be explainedwith reference to the drawings.

FIG. 1 shows a configuration of an image processing apparatus 1according to the embodiment.

The image processing apparatus 1 includes a smoothing processing unit 2,a thinning processing unit 3, an edge direction determination unit 4 anda blending processing unit 5 as shown in FIG. 1.

The image processing apparatus 1 includes a line memory for total ofnine pixels of lines 0 to 8 in the sub-scanning direction and image datais input to and stored in the line memory while shifting by one pixel inthe main scanning direction every clock. The image data is 8 bit and thevalue range of the pixel value is from 0 to 255. In a case of a colorimage, image data of four colors which are Y (yellow), M (magenta), C(cyan) and K (black) is input.

The smoothing processing unit 2 performs smoothing processing on eachpixel of the image data. Smoothing processing is also calledanti-aliasing processing.

Smoothing processing is performed in units of 7×7 pixels. The smoothingprocessing unit 2 obtains 7×7 pixels from the line memory by storingimage data of seven lines for seven clocks, that is, for seven pixels inthe main scanning direction.

Three smoothing processing units 2 are provided. Image data of lines 0to 6 is input to the upper smoothing processing unit 2, image data oflines 1 to 7 is input to the middle smoothing processing unit 2, andimage data of lines 2 to 8 is input to the lower smoothing processingunit 2.

FIG. 2 shows a region of 7×7 pixels which is input to the middlesmoothing processing unit 2. In FIG. 2, the pixels are respectivelyassigned with identification numbers 01 to 49 to indicate the pixellocations.

Each smoothing processing unit 2 performs smoothing processing on thepixel located at the center of the 7×7 pixels, and calculates andoutputs a change amount dSMT in pixel value due to smoothing processing.That is, pixel values of 1×7 pixels are input to each smoothingprocessing unit 2 every clock, and change amounts dSMT in pixel value of1×3 pixels (pixels of identification numbers 18, 25 and 32) are output.

Each smoothing processing unit 2 includes an edge determination unit 21,a template determination unit 22, a template selection unit 23 and apixel value calculation unit 24 as shown in FIG. 3.

Though each smoothing processing unit 2 performs the processing onpixels at different location, the processing is the same in content.Therefore, smoothing processing will be explained by taking the middlesmoothing processing unit 2 which performs smoothing processing on thetarget pixel of identification number 25 as an example.

The edge determination unit 21 determines whether an edge is included inthe 7×7 pixels because the target to be smoothed by smoothingprocessing, that is, the pixel in which the pixel value thereof is to bechanged is an edge of a character or a line drawing.

The edge determination unit 21 calculates a difference in pixel valuesbetween two adjacent pixels. If the difference is equal to or greaterthan threshold value th1, the edge determination unit 21 determines thatthere is an edge between the two pixels. If the difference is smallerthan the threshold value th1, the edge determination unit 21 determinesthat there is no edge between the two pixels. Th1 is a threshold valuewhich is determined in advance for the edge determination. Thedifference is calculated in absolute value and the two pixels whosedifference is calculated are pixels adjacent to each other in apredetermined positional relationship.

The following is combinations of two pixels A and B whose difference iscalculated. Each combination is expressed by “identification number ofpixel A—identification number of pixel B”.

03-10, 04-11, 05-12, 10-17, 10-18, 11-17, 11-18, 11-19, 12-18, 12-19,15-16, 16-17, 16-24, 17-18, 17-23, 17-24, 18-19, 18-24, 18-25, 18-26,19-20, 19-26, 19-27, 20-21, 20-26, 22-23, 23-24, 23-31, 24-25, 24-30,24-31, 24-32, 25-26, 25-32, 26-27, 26-32, 26-33, 26-34, 27-28, 27-33,29-30, 30-31, 31-32, 31-38, 31-39, 32-33, 32-38, 32-39, 32-40, 33-34,33-39, 33-40, 34-35, 38-45, 39-46, 40-47.

When the edge determination unit 21 determines that there is an edge,the edge determination unit 21 outputs V[AB]=1. When the edgedetermination unit 21 determines that there is no edge, the edgedetermination unit 21 outputs V[AB]=0. In V[AB], A and B indicate twopixels whose difference was calculated, and the value of identificationnumbers 01 to 49 of each pixel A and B is input. For example, when it isdetermined that there is an edge between pixels A and B from thedifference between the pixel A of identification number 03 and the pixelB of identification number 10, V[0310]=1 is output.

There are total of 56 combinations of pixels A and B, and total of 56subtraction results need to be obtained for one clock as an arithmeticcircuit. However, the number of subtraction can be reduced by optimizingthe arithmetic circuit. The arithmetic circuit outputs the arithmeticresult of the target pixel every clock, and the target pixel shifts tothe right by one pixel every clock. Therefore, the pixels A and Bwherein the subtraction was performed in the present clock become pixelsA-1 and B-1 in the next clock. Then, the subtraction result V[AB] whichwas used in the present clock becomes the same as the value ofV[(A-1)(B-1)] in the next clock. When another one clock elapses, thissubtraction result V[(A-1)(B-1)] becomes the same value as V[(A-2)(B-2)]. By using such a characteristic, it is possible to reusesubtraction results which are stored as subtraction results of the sameline by storing the subtraction result for six clocks.

The following expresses that one subtraction result can be reused as asubtraction result which is described on the immediate left thereof inthe next clock or in the following clocks. According to this, onesubtraction result can be reused as up to six subtraction results bystoring the one subtraction result for six clocks. With a circuitconfiguration which performs such reusing of subtraction results, it ispossible to reduce the number of subtraction which had to be performed56 times to essentially 17 times.

V[0310]←V[0411]←V[0512]

V[1017]←V[1118]←V[1219]

V[1018]←V[1119]

V[1117]←V[1218]

V[1516]←V[1617]←V[1718]←V[1819]←V[1920]←V[2021]

V[1624]←V[1826]←V[1927]

V[1723]←V[1824]←V[2026]

V[1724]←V[1825]←V[1926]

V[2223]←V[2324]←V[2425]←V[2526]←V[2627]←V[2728]

V[2331]←V[2432]←V[2634]

V[2430]←V[2632]←V[2733]

V[2431]←V[2532]←V[2633]

V[2930]←V[3031]←V[3132]←V[3233]←V[3334]←V[3435]

V[3138]←V[3239]←V[3340]

V[3139]←V[3240]

V[3238]←V[3339]

V[3845]←V[3946]←V[4047]

The template determination unit 22 checks V[AB] which is output from theedge determination unit 21 against the templates and determines amatching template. The templates are designed so that edge patterns tobe smoothed can be detected.

FIG. 4 shows an example of templates. In FIG. 4, the number above eachtemplate is an identification number which is appended to the template.

The pixels on the template are classified into three types which are a,b and c as shown in FIG. 4. The template determination unit 22determines that a template is a match when V[AB]=0 between the pixelscorresponding to the classification a, V[AB]=0 between the pixelscorresponding to the classification b and V[AB]=1 between the pixelscorresponding to the classification a and the pixels corresponding tothe classification b on the template are fulfilled. Presence or absenceof an edge does not matter in the pixel of classification c. In somecases, not only one template but a plurality of templates can be amatch. The template determination unit 22 checks V[AB] against all thetemplates and detects all the matching templates.

For example, when all of V[1824]=0, V[2632]=0, V[1826]=1, V[1819]=0 andV[3132]=0 are met, the template determination unit 22 determines thatthe template of identification number 21 is a match. In addition, whenall of V[2324]=0, V[3031]=0, V[1920]=0 and V[2627]=0 are met, thetemplate determination unit 22 determines that not only the template ofidentification number 21, but also the template of identification number213 is a match.

The template selection unit 23 selects one template from one or aplurality of matching templates obtained by checking against thetemplates by the template determination unit 22. A priority order is setfor the templates shown in FIG. 4. The template selection unit 23selects a template which has the highest priority from the matchingtemplates according to the priority order. The priority order is set forthe templates in the following descending order: identification number24, 23, 22, 21, 233, 213, 243, 223, 252, 251, 254, 253, 262, 261, 264and 263.

The pixel value calculation unit 24 uses pixel values of the pixelscorresponding to the classifications a and b set on the template whichwas selected by the template selection unit 23 and calculates andoutputs the change amount dSMT in pixel value of the target pixel due tosmoothing processing of the target pixel.

Calculation formulae of dSMT are as follows. In the calculationformulae, C is a pixel value of each pixel indicated by theidentification number inside the parenthesis. The pixel value of thetarget pixel is indicated by C[25].

When the identification number of the selected template is 21, 22, 23 or24,dSMT=(C[18]+C[25]+C[32])/3−C[25]

When the identification number of the selected template is 213 or 233,dSMT=(C[18]×2+C[25]+C[32]×2)/5−C[25]

When the identification number of the selected template is 223 or 243,dSMT=(C[24]×2+C[25]+C[26]×2)/5−C[25]

When the identification number of the selected template is 251 or 252,dSMT=(C[25]×4+C[32])/5−C[25]

When the identification number of the selected template is 253 or 254,dSMT=(C[25]×4+C[18])/5−C[25]

When the identification number of the selected template is 261 or 262,dSMT=(C[25]×4+C[26])/5−C[25]

When the identification number of the selected template is 263 or 264,dSMT=(C[25]×4+C[24])/5−C[25]

By adding the obtained change amount dSMT to the pixel value of thetarget pixel, a pixel value of the target pixel after the smoothingprocessing is obtained. According to such smoothing processing, a targetpixel corresponding to an edge to be smoothed can be detected bydetermining whether a difference in pixel value between adjacent twopixels is nearly the same value or a different value. Because the pixelvalue of the detected target pixel is converted to a weighted averagevalue of pixel values of the target pixel and surrounding pixelsthereof, smoothing processing can be performed for any pixel value ofthe foreground and the background including halftone.

The thinning processing unit 3 performs thinning processing on eachpixel of image data.

Thinning processing is performed in units of 3×3 pixels. The thinningprocessing unit 3 inputs image data of three lines for three clocks fromthe line memory and obtains 3×3 pixels. Three thinning processing units3 are provided. Image data of lines 2 to 4 is input to the upperthinning processing unit 3, image data of lines 3 to 5 is input to themiddle thinning processing unit 3 and image data of lines 4 to 6 isinput to the lower thinning processing unit 3. Each thinning processingunit 3 performs thinning processing on a pixel which is located at thecenter of the 3×3 pixels, and calculates and outputs the change amountdSMT in pixel value due to the thinning processing. That is, pixelvalues of 1×3 pixels are input to each thinning processing unit 3 everyclock and the change amounts dSMT in pixel value of 1×3 pixels (pixelsof identification numbers 18, and 32) are output.

Each thinning processing unit 3 includes an edge intensity calculationunit 31, an edge determination unit 32, a thinning determination unit 33and a pixel value calculation unit 34 as shown in FIG. 5.

Though each thinning processing unit 3 performs the processing on apixel at different location, the processing is the same in content.Therefore, the thinning processing will be explained by taking themiddle thinning processing unit 3 which performs processing on thetarget pixel of the identification number 25 as an example.

The edge intensity calculation unit 31 calculates the edge intensity inthe target pixel. The edge intensity calculation unit 31 calculatesdifferences EC) to E7 between the target pixel and the surroundingpixels thereof, and obtains the maximum value PED among them. Thecalculation formulae of E0 to E7 are as follows. C is a pixel value ofeach pixel which is indicated by the identification number inside theparenthesis.E0=C[25]−C[17]E1=C[25]−C[18]E2=C[25]−C[19]E3=C[25]−C[24]E4=C[25]−C[26]E5=C[25]−C[31]E6=C[25]−C[32]E7=C[25]−C[33]

The edge intensity calculation unit 31 inverts the signs of E0 to E7 andobtains the maximum value RED among them. The thinning processing unit 3modifies to PED=0 if PED<RED, and modifies to RED=0 if RED<PED.

E0 to E7, PED and RED which are obtained as mentioned above are edgeintensity.

The edge determination unit 32 obtains TPED and TRED by the followingformulae using PED and RED which are obtained from image data of eachcolor in a case of color image. The PED and RED shown with y, m, c and kinside the parenthesis indicate edge intensity which are obtained fromimage data of yellow, magenta, cyan and black color, respectively.TPED=(PED[y]×Wy+PED[m]×Wm+PED[c]×Wc+PED[k]×Wk)TRED=(RED[y]×Wy+RED[m]×Wm+RED[c]×Wc+RED[k]×Wk)

In the above formulae, Wy, Wm, Wc and Wk are predetermined coefficientsand Wy+Wm+Wc+Wic≦255.

In a case of monochrome image, TPED=PED[k]×Wk and TRED=RED[k]×Wk.

TPED and TRED are values which are obtained by weighting the edgeintensity PED and RED of each color with coefficients Wy, Wm, Wc and Wkequivalent to relative luminosity respectively and adding up theweighted values. TPED and TRED can be a visual index of density wheneach color is overlaid. Because the target of the thinning is an edge inthe foreground, the edge determination unit 32 determines which of thetarget pixel and the surrounding pixels is the foreground or thebackground by determining magnitude relationship of TPED and TRED. IfTPED>TRED, the edge determination unit 32 determines that the targetpixel is an edge in the foreground which has a greater density than thebackground, and outputs ED=1. On the other hand, if TPED≦TRED, the edgedetermination unit 32 determines that the target pixel is not an edge inthe foreground, and outputs ED=0.

The thinning determination unit 33 determines whether the target pixelwhich is determined to be an edge in the foreground can be a target ofthinning. In a case wherein a target pixel which is an edge does nothave a sufficient pixel value for thinning, that is, to be reduced, thetarget pixel need to be excluded from the target of the thinning,because the pixel value will be very small or vanished causing breaks inthe image by reducing the pixel value. The thinning determination unit33 compares the pixel value C[25] of the target pixel in each color tothreshold value Th2. If the pixel value C[25] in any color is equal toor greater than the threshold value Th2, the thinning determination unit33 determines that the pixel has a sufficient pixel value for thethinning, and outputs SS=1. On the other hand, if the pixel value C[25]of the target pixel in every color is smaller than the threshold valueTh2, the thinning determination unit 33 determines that the target pixelis not a target of thinning because the pixel does not have a sufficientpixel value for the thinning, and outputs SS=0.

The pixel value calculation unit 34 calculates and outputs the changeamount dST in pixel value of the target pixel due to thinningprocessing.

When ED=1 and SS=1, the target pixel is an edge and has a sufficientpixel value for thinning. Thus, the pixel value calculation unit 34performs thinning on the target pixel and calculates the change amountdST in pixel value by the following formula. The change amount dST isobtained for each color by using PED and RED which are obtained for eachcolor.dST=(PED−RED)×STVL

The above STVL is a coefficient to adjust intensity of the thinning, andis previously determined for each color. STVL can have a value range of0 to 1.

By adding the obtained change amount dST to the original pixel value,the pixel value after thinning is obtained. As shown in the calculationformula of dST, thinning processing not only includes a case wherein dSTis a negative value and the pixel value of the target pixel is decreasedto literally thin the target pixel, but also includes a case wherein dSTis a positive value and the pixel value of the target pixel is increasedto thicken the target pixel.

If ED=1 and SS=1 is not met, the target pixel is not an edge, or is anedge which does not have a sufficient pixel value for thinning. Thus,the pixel vale calculation unit 34 does not perform thinning of thetarget pixel, and outputs the change amount dST=0 in pixel value.

The edge direction determination unit 4 determines an edge direction ineach pixel of the image data.

The edge direction is determined in units of 5×5 pixels. The edgedirection determination unit 4 inputs image data of lines 2 to 6 forfive clocks from the line memory and obtains 5×5 pixels with the targetpixel of the blending processing unit 5 located at the center thereof.The edge direction determination unit 4 determines and outputs the edgedirection pos in the target pixel which is located at the center of theinput 5×5 pixels. That is, pixel values of 1×5 pixels are input to theedge direction determination unit 4 and the edge direction pos for onepixel is output every clock. The edge direction is a direction from apixel with a small pixel value to a pixel with a large pixel value. Whenthe target pixel is an edge in the foreground or the background, thedirection from the background to the foreground is determined as theedge direction.

The edge direction determination unit 4 calculates SP which is adifference between the target pixel (pixel of identification number 25)and each of the eight surrounding pixels (pixels of identificationnumbers 17, 18, 19, 24, 26, 31, 32 and 33) which are adjacent to thetarget pixel, and SF which is a difference between the target pixel(pixel of identification number 25) and each of the surrounding pixels(pixels of identification numbers 11, 23, 27 and 39) which are twopixels away from the target pixel in upper, lower, left and rightdirections.

The calculation formulae are as follows. C is a pixel value of eachpixel indicated by the identification number inside the parenthesis.SP[u]=C[25]−C[18]SP[l]=C[25]−C[24]SP[r]=C[25]−C[26]SP[d]=C[25]−C[32]SF[u]=C[25]−C[11]SF[1]=C[25]−C[23]SF[r]=C[25]−C[27]SF[d]=C[25]−C[39]

The edge direction determination unit 4 respectively determines edgedirection x in the main scanning direction and edge direction y in thesub scanning direction of the target pixel. The x and y can have a valueof 0 or ±1. “0” indicates that there is no edge and “1” indicates thatthere is an edge. Plus and minus signs correspond to the directions.

For example, if SP[1]<SP[r], the pixel value of the right surroundingpixel is smaller between the pixels on left and right of the targetpixel as shown in FIG. 6. Thus, the edge direction determination unit 4determines the edge direction in the main scanning direction to be leftand outputs x=−1. On the other hand, if SP[l]>SP[r], the pixel value ofthe left surrounding pixel is smaller between the pixels on left andright of the target pixel as shown in FIG. 7. Thus, the edge directiondetermination unit 4 determines the edge direction in the main scanningdirection to be right and outputs x=+1.

Similarly, the edge direction in the sub scanning direction isdetermined by comparing SP[u] and SP[d]. If SP[u]>SP [d], the edgedirection determination unit 4 determines the edge direction in the subscanning direction to be down, and outputs y=−1. If SP[u]<SP [d], theedge direction determination unit 4 determines the edge direction in thesub scanning direction to be up, and outputs y=+1.

In a case of SP[l]=SP[r], there is no difference in pixel value betweenleft and right pixels of the target pixel. Similarly, in a case ofSP[u]=SP[d], there is no difference in pixel value between the pixelsabove and below the target pixel. In such cases, the edge directiondetermination unit 4 determines that there is no edge on the left andright or above and below of the target pixel, and outputs x=0 or y=0,respectively.

When the target pixel is not an edge but an inner edge which is onepixel inside than the edge, the edge direction determination unit 4determines the edge direction as well.

When the target pixel is an inner edge, the edge direction is x=y=0.Thus, when the edge direction is x=y=0, the edge direction determinationunit 4 modifies edge directions x and y by SF[l], SF[r], SF[u] and SF[d]which are obtained from the surrounding pixels located two pixels awayfrom the target pixel.

The edge direction determination unit 4 modifies x=0 to x=−1 ifSF[l]<SF[r], and modifies x=0 to x=+1 if SF[l]>SF[r]. Similarly, theedge direction determination unit 4 modifies y=0 to y=−1 if SF[u]>SF[d],and modifies y=0 to y=+1 if SF[u]<SF[d]. If SF[l]=SF[r], the edgedirection determination unit 4 does not perform modification and outputsx=0 as it is. In a case of SF[u]=SF[d], the edge direction determinationunit 4 does not perform modification as well and outputs y=0 as it is.

For example, if the surrounding pixel on the right which is two pixelsaway from the target pixel is an edge and the target pixel is an inneredge as shown in FIG. 8, the edge direction determination unit 4determines that x=0 because SP[1]=SP[r]. However, x=0 is modified to bex=−1 because SF[l]<SF[r].

The edge direction determination unit 4 determines and outputs theoverall edge direction pos by the combination of edge direction x in themain scanning direction and edge direction y in the sub scanningdirection. Pos can have a value of 0 to 4. 0 indicates center (no edge),1 indicates leftward direction, 2 indicates rightward direction, 3indicates upward direction and 4 indicates downward direction. Edgedirections pos corresponding to combinations of x and y are as follows.

When x=1 and y=−1, pos=4

When x=1 and y=0, pos=2

When x=1 and y=+1, pos=2

When x=0 and y=−1, pos=4

When x=0 and y=0, pos=0

When x=0 and y=+1, pos=3

When x=−1 and y=−1, pos=1

When x=−1 and y=0, pos=1

When x=−1 and y=+1, pos=3

The blending processing unit 5 decides the pixel value of each pixelwhen thinning processing and smoothing processing are realized at thesame time.

The blending processing unit 5 inputs image data of lines 2 to 6 of theline memory for five clocks and obtains 5×5 pixels having the targetpixel of identification number 25 located at the center thereof. Also,the blending processing unit 5 shifts the processing results (changeamounts dSMT and dST) of 1×3 pixels which are output from the smoothingprocessing unit 2 and the thinning processing unit 3 by three pixels inthe main scanning direction, and inputs processing results for 3×3pixels having the target pixel of identification number 25 located atthe center thereof. The blending processing unit 5 also inputs the edgedirection pos of the target pixel from the edge direction determinationunit 4. The blending processing unit 5 decides the pixel value G of whenboth thinning and smoothing are realized at the same time in the targetpixel depending on the combination of whether thinning is performed ornot and whether smoothing is performed or not on the target pixel. Todecide the pixel value G, each pixel value C of the target pixel,surrounding pixels adjacent to the target pixel in the upper, lower,left and right directions and surrounding pixels which are two pixelsaway from the target pixel in the upper, lower, left and rightdirections of the target pixel, the change amounts dST and dSMT in pixelvalue of the target pixel and in pixel values of the surrounding pixelsadjacent to the target pixel in the upper, lower, left and rightdirections, and the edge direction pos on the target pixel are used.

The blending processing unit 5 includes a classification unit 50 andpixel value deciding units 51 to 54 as shown in FIG. 9.

The classification unit 50 classifies the state of thinning andsmoothing in the target pixel into cases 1 to 4 depending on thecombination of whether thinning is performed or not and whethersmoothing is performed or not on the target pixel. Whether the thinningis performed or not and whether the smoothing is performed or not can bedetermined by whether the values of the change amounts dST and dSMT arezero. The classification unit 50 determines that thinning is performedon the target pixel as a result of thinning processing if the changeamount dST[25] which is input from the thinning processing unit 3 withregard to the target pixel meets dST[25]≠0, and determines that thinningis not performed if the change amount dST[25] meets dST[25]=0.Similarly, the classification unit 50 determines that smoothing isperformed if the change amount dSMT[25] which is input from thesmoothing processing unit 2 with regard to the target pixel meetsdSMT[25]≠0, and determines that smoothing is not performed if the changeamount dSMT[25] meets dSMT[25]=0.

FIG. 10 is a flowchart showing a flow of processing performed by theclassification unit 50.

As shown in FIG. 10, when the change amounts of the target pixel meetdST[25]≠0 and dSMT[25]≠0(step S11; Y), the classification unit 50classifies the case into case 1 (step S12). When the change amounts ofthe target pixel meet dST[25]≠0 and dSMT[25]=0 (step S11; N, S13; Y),the classification unit 50 classifies the case into case 2 (step S14).When the change amounts of the target pixel meet dST[25]=0 anddSMT[25]≠0(step S13; N, S15; Y), the classification unit 50 classifiesthe case into case 3 (step S16). When the change amounts of the targetpixel meet dST[25]=0 and dSMT[25]=0 (step S15; N, S17; Y), theclassification unit 50 classifies the case into case 4 (step S18).

The classification unit 50 outputs the change amounts dST and dSMT,pixel value C and edge direction pos to the pixel value deciding unit 51in case 1, to the pixel value deciding unit 52 in case 2, to the pixelvalue deciding unit 53 in case 3 and to the pixel value deciding unit 54in case 4.

The pixel value deciding units 51 to 54 determine the pixel value G[25]of the target pixel of when both thinning processing and smoothingprocessing are realized at the same time depending on the cases 1 to 4,respectively.

<Case 1>

FIG. 11 is a flowchart of processing which is executed by the pixelvalue deciding unit 51 in case 1.

In case 1, both thinning and smoothing are performed on the targetpixel, and thus the target pixel is assumed to be an edge in foregroundas shown in FIG. 12A or an edge in background as shown in FIG. 12B. Ifthe target pixel is an edge in foreground, both of the change amountsdST and dSMT of the target pixel M are negative values as shown in FIG.12A, and thus the pixel value is decreased by the thinning processingand the smoothing processing. If the target pixel is an edge inbackground, both of the change amounts dST and dSMT of the target pixelM are positive values as shown in FIG. 12B, and thus the pixel value isincreased by the thinning processing and the smoothing processing.

In both cases, the target pixel M is thinned and smoothed, and thesurrounding pixel N adjacent to the target pixel M in the edge directionpos or in the opposite-edge direction apos which is an oppositedirection of the edge direction is not thinned nor smoothed. Therefore,the pixel value deciding unit 51 decides and outputs the value which isobtained by adding the change amounts dST[25] and dSMT[25] to theoriginal pixel value C[25] of the target pixel as the pixel value G[25]of the target pixel when thinning processing and smoothing processingare realized at the same time as shown in FIG. 11 (step S21).

It does not appear natural if the decided pixel value G[25] of thetarget pixel does not range between the pixel value of the foregroundand the pixel value of the background because the density of the targetpixel stands out at the border of the foreground and the background.Therefore, if the pixel value G[25] of the target pixel is larger thanthe pixel value C[pos] of the foreground, that is, the surrounding pixeladjacent to the target pixel in the edge direction (step S22; Y), thepixel value deciding unit 51 modifies the decided pixel value G[25] ofthe target pixel to the pixel value of the foreground C[pos] (step S23).If the pixel value G[25] of the target pixel is smaller than the pixelvalue C[apos] of the background, that is, the surrounding pixel adjacentto the target pixel in the opposite-edge direction of the target pixel(step S22; Y), the pixel value deciding unit 51 modifies the decidedpixel value G[25] of the target pixel to the pixel value C[apos] of thebackground (step S23). Apos is set to have a value of direction which isopposite of the edge direction pos. That is, apos=2 is set if pos=1, andapos=4 is set if pos=3. If there is no edge direction, pos=apos=0.

<Case 2>

FIG. 13 is a flowchart of processing which is executed by the pixelvalue deciding unit 52 in case 2.

In case 2, only the thinning is performed on the target pixel, and thusthe target pixel is assumed to be an edge in foreground as shown in FIG.14A or an edge in background as shown in FIG. 14B. If the target pixelis an edge in foreground, the change amount dST of the target pixel M isa negative value as shown in FIG. 14A, and the pixel value is decreaseddue to thinning processing. The change amount dSMT of the surroundingpixel N adjacent to the target pixel M in the opposite-edge directionapos is a positive value, and the pixel value is increased due tosmoothing processing. If the target pixel is an edge in background, thechange amount dST of the target pixel M is a positive value as shown inFIG. 14B, and the pixel value is increased due to thinning processing.The change amount dSMT of the surrounding pixel N adjacent to the targetpixel M in the edge direction pos is a negative value, and the pixelvalue is decreased due to smoothing processing.

In such way, when the surrounding pixel which is not thinned but issmoothed is adjacent to the target pixel in the edge direction pos or inthe opposite-edge direction apos, the target pixel being thinned, thepixel value deciding unit 52 decides the pixel value of the surroundingpixel as well as the target pixel of when thinning processing andsmoothing processing are realized at the same time.

Because only the thinning is performed on the target pixel, the pixelvalue deciding unit 52 temporarily decides the value obtained by addingthe change amount dST[25] in pixel value of the target pixel due tothinning processing to the original pixel value C[25] of the targetpixel as the pixel value G[25] of the target pixel of when thinningprocessing and smoothing processing are realized at the same time asshown in FIG. 13 (step S31). Subsequently, the pixel value deciding unit52 determines in which of the edge direction pos and the opposite-edgedirection apos the smoothed surrounding pixel is adjacent to the targetpixel.

If the edge direction pos, the change amounts dST[pos] and dSMT[pos]which are input with regard to the surrounding pixel adjacent to thetarget pixel in the edge direction pos meet pos≠0, dST[pos]=0 anddSMT[pos]≠0 (step S32; Y), the pixel value deciding unit 52 determinesthat the smoothed surrounding pixel is adjacent to the target pixel inthe edge direction pos (step S33).

If the opposite-edge direction apos, the change amounts dST[apos] anddSMT[apos] which are input with regard to the surrounding pixel adjacentto the target pixel in the opposite-edge direction apos meet apos≠0,dST[apos]=0 and dSMT[apos]≠0 (step S32; N, S34; Y), the pixel valuedeciding unit 52 determines that the smoothed surrounding pixel isadjacent in the background, that is, adjacent to the target pixel in theopposite-edge direction apos (step S35).

If none of the conditions is met (step S34; N), the pixel value decidingunit 52 determines that the smoothed surrounding pixel is not adjacentto the target pixel in the edge direction pos nor in the opposite-edgedirection apos, and outputs the pixel value G[25] of the target pixelwhich was decided in step S31.

When the direction in which the smoothed surrounding pixel is adjacentto the target pixel is specified, the pixel value deciding unit 52decides the value which is obtained by adding the change amount dST[25]in pixel value of the target pixel due to thinning processing and thechange amount dSMT[P] in pixel value of the surrounding pixel due tosmoothing processing to the original pixel value C[25] of the targetpixel as the pixel value G[25] of the target pixel (step S36). Pos orapos is input for P. If the smoothed surrounding pixel is adjacent tothe target pixel in the edge direction pos, dSMT[pos] is used fordSMT[P]. If the smoothed surrounding pixel is adjacent to the targetpixel in the opposite-edge direction apos, dSMT[apos] is used fordSMT[P].

Thereafter, the processing in case 2 is same as in case 1 in the respectthat the pixel value G[25] of the target pixel is modified by pixelvalues of the foreground and the background. Therefore, same stepnumbers are used for the steps in FIG. 13 which are same as those inFIG. 11 and the explanation thereof is omitted.

<Case 3>

FIG. 15 is a flowchart of processing which is executed by the pixelvalue deciding unit 53 in case 3.

In case 3, only the smoothing is performed on the target pixel, and thusthe target pixel is assumed to be an edge in background as shown in FIG.16A or an edge in foreground as shown in FIG. 16B. If the target pixelis an edge in background, the change amount dSMT of the target pixel Mis a positive value as shown in FIG. 16A and the pixel value isincreased due to the smoothing processing. The change amount dST of thesurrounding pixel N adjacent to the target pixel M in the edge directionpos is a negative value, and the pixel value is decreased due to thethinning processing. If the target pixel is an edge in foreground, thechange amount dSMT of the target pixel M is a negative value as shown inFIG. 16B and the pixel value is decreased due to the smoothingprocessing. The change amount dST of the surrounding pixel N adjacent tothe target pixel M in the opposite-edge direction apos is a positivevalue, and the pixel value is increased due to the thinning processing.

In such way, when the thinned surrounding pixel is adjacent to thetarget pixel in the edge direction pos or in the opposite-edge directionapos, the target pixel being smoothed, the pixel value deciding unit 53decides the pixel value G[P] of the surrounding pixel as well as thetarget pixel of when thinning processing and smoothing processing arerealized at the same time.

Because only the smoothing is performed on the target pixel, the pixelvalue deciding unit 53 temporarily decides the value obtained by addingthe change amount dSMT[25] of the target pixel due to smoothingprocessing to the original pixel value C[25] of the target pixel as thepixel value G[25] of the target pixel of when thinning processing andsmoothing processing are realized at the same time as shown in FIG. 15(step S41). Subsequently, the pixel value deciding unit 53 determines inwhich direction of the edge direction pos or the opposite-edge directionapos the thinned surrounding pixel is adjacent to the target pixel.

If the edge direction pos, the change amounts dST[pos] and dSMT[pos]which are input with regard to the surrounding pixel adjacent to thetarget pixel in the edge direction pos meet pos≠0, dST[pos]≠0 anddSMT[pos]=0 (step S42; Y), the pixel value deciding unit 53 determinesthat the thinned surrounding pixel is adjacent to the target pixel inthe edge direction pos (step S43).

If the opposite-edge direction apos, the change amounts dST[apos] anddSMT[apos] which are input on the surrounding pixel adjacent to thetarget pixel in the opposite-edge direction apos meet apos≠0,dST[apos]≠0 and dSMT[apos]=0 (step S42; N, S44; Y), the pixel valuedeciding unit 53 determines that the thinned surrounding pixel isadjacent to the target pixel in the opposite-edge direction apos (stepS45).

If none of the conditions is met (step S44; N), the pixel value decidingunit 53 determines that the thinned surrounding pixel is not adjacent tothe target pixel in the edge direction pos nor in the opposite-edgedirection apos, and outputs the pixel value G[25] of the target pixelwhich was decided in step S41.

When the direction in which the thinned surrounding pixel is adjacent isspecified, the pixel value deciding unit 53 inputs the larger value forL and the smaller value for S among the pixel value C[25] of the targetpixel and the pixel value C[P] of the thinned surrounding pixel (stepS46), and calculates temp by the following formula (step S47).temp=L+S+dST[P]+dSMT[25]

For P, pos or apos is input. If the thinned surrounding pixel isadjacent to the target pixel in the edge direction pos, C[P] and dST[P]are C[pos] and dST[pos], respectively. If the thinned surrounding pixelis adjacent to the target pixel in the opposite-edge direction, C[P] anddST[P] are C[apos] and dST[apos], respectively.

Temp is the sum which is obtained by adding up the pixel value of thesmoothed target pixel and the pixel value of the thinned surroundingpixel. The pixel value deciding unit 53 distributes the temp to thetarget pixel and the surrounding pixel.

If the total of the change amount dSMT[25] in pixel value of the targetpixel due to smoothing processing and the change amount dST[P] in pixelvalue of the surrounding pixel due to thinning processing is a positivevalue, temp which is the sum of the pixel values of these two pixelsbecomes larger than L+S which is total of the original pixel values dueto smoothing of the target pixel and thinning of the surrounding pixel.In this case, the pixel value deciding unit 53 distributes the pixelvalue L to the pixel which has the larger original pixel value, anddistributes the rest of the pixel value temp-L to the other pixel value.When the sum temp is larger than twice the value of L, both the targetpixel and the surrounding pixel have pixel values which are equal to orlarger than L, and do not fit in the foreground nor the backgroundnaturally. In this case, the pixel value deciding unit 53 distributesthe largest acceptable value of L to both pixels.

As shown in FIG. 15, when temp>L+S is fulfilled (step S48; Y) andtemp<L×2 is fulfilled (step S49; Y), the pixel value deciding unit 53decides the pixel value G[25] of the target pixel=L and the pixel valueG[P] of the surrounding pixel=temp-L if the original pixel value C[25]of the target pixel is larger than the original pixel value C[P] of thesurrounding pixel. Further, the pixel value deciding unit 53 decides thepixel value G[25] of the target pixel=temp−L and the pixel value G[P] ofthe surrounding pixel=L if the original pixel value C[25] of the targetpixel is smaller than the original pixel value C[P] of the surroundingpixel, (step S50).

When temp>L+S is fulfilled (step S48; Y) and temp<L×2 is not fulfilled(step S49; N), the pixel value deciding unit 53 decides the pixel valueG[25] of the target pixel=L and the pixel value G[P] of the surroundingpixel=L (step S51).

On the other hand, if the total of the change amount dSMT[25] in pixelvalue of the target pixel due to smoothing processing and the changeamount dST[P] in pixel value of the surrounding pixel due to thinningprocessing is a negative value, temp which is the sum of the pixelvalues of these two pixels becomes smaller than L+S which is the totalof the original pixel values due to smoothing of the target pixel andthinning of the surrounding pixel. In this case, the pixel valuedeciding unit 53 distributes the pixel value S to the pixel which hasthe smaller original pixel value, and distributes the rest of the pixelvalue temp−S to the other pixel. When the sum temp is smaller than twicethe value of S, both the target pixel and the surrounding pixel havepixel values which are equal to or smaller than S, and do not fit in theforeground nor the background naturally. In this case, the pixel valuedeciding unit 53 distributes the largest acceptable value of S to bothpixels.

As shown in FIG. 15, when temp>L+S is not fulfilled (step S48; N) andtemp>S×2 is fulfilled (step S52; Y), if the original pixel value C[25]of the target pixel is larger than the original pixel value C[P] of thesurrounding pixel, the pixel value deciding unit 53 decides the pixelvalue G[25] of the target pixel=temp−S and the pixel value G[P] of thesurrounding pixel=S. If the original pixel value C[25] of the targetpixel is smaller than the original pixel value C[P] of the surroundingpixel, the pixel value deciding unit 53 decides the pixel value G[25] ofthe target pixel=S and the pixel value G[P] of the surroundingpixel=temp−S (step S53).

When temp>L+S is not fulfilled (step S48; N) and temp>S×2 is notfulfilled, either (step S52; N), the pixel value deciding unit 53determines the pixel value G[25] of the target pixel=S and the pixelvalue G[P] of the surrounding pixel=S (step S54).

<Case 4>

FIG. 17 is a flowchart of processing which is executed by the pixelvalue deciding unit 54 in case 4.

In case 4, neither thinning nor smoothing is performed on the targetpixel, and thus the target pixel is assumed to be an inner edge inforeground as shown in FIG. 18A or an inner edge in background as shownin FIG. 18B. If the target pixel is an inner edge in foreground, neitherthinning nor smoothing is performed on the target pixel Mas shown inFIG. 18A. However, the change amounts dST and dSMT of the surroundingpixel N adjacent to the target pixel M in the opposite-edge directionapos are both negative values, and thus the pixel value is decreased dueto thinning processing and smoothing processing. If the target pixel isan inner edge in background, neither thinning nor smoothing is performedon the target pixel M as shown in FIG. 18B. However, the change amountsdST and dSMT of the surrounding pixel N adjacent to the target pixel Min the edge direction are both positive values, and thus the pixel valueis increased due to thinning processing and smoothing processing.

In such way, when the surrounding pixel which is both thinned andsmoothed is adjacent to the target pixel in the edge direction pos or inthe opposite-edge direction apos, the pixel value deciding unit 53decides the pixel value G[P] of when thinning processing and smoothingprocessing are realized at the same time on the surrounding pixel aswell as the target pixel.

Because neither thinning nor smoothing is performed on the target pixel,the pixel value deciding unit 54 temporarily decides the original pixelvalue C[25] of the target pixel as the pixel value G[25] of the targetpixel of when thinning processing and smoothing processing are realizedat the same time as shown in FIG. 17 (step S61).

Subsequently, the pixel value deciding unit 54 determines whether threepixels which are the target pixel, the surrounding pixel adjacent to thetarget pixel in the edge direction pos and the surrounding pixeladjacent to the target pixel in the opposite-edge direction apos havenearly the same pixel values (step S62). This is because the pixelvalues of the three pixels which are the target pixel and thesurrounding pixels adjacent to the target pixel in the edge directionpos and in the opposite-edge direction apos are nearly the same when thetarget pixel is an inner edge. If both of the value obtained bysubtracting the pixel value C[apos] of the surrounding pixel adjacent tothe target pixel in the opposite-edge direction apos from the pixelvalue C[pos] of the surrounding pixel adjacent to the target pixel inthe edge direction pos and the value obtained by subtracting the pixelvalue C[25] of the target pixel from the pixel value C[pos] of thesurrounding pixel adjacent to the target pixel in the edge direction posare smaller than the threshold value Th3, the pixel value deciding unit54 determines that the pixel values of the three pixels are nearly thesame, and if either of the above values exceeds the threshold value Th3,the pixel value deciding unit 54 determines that the pixel values of thethree pixels are not nearly the same.

If the pixel values of the three pixels are not nearly the same (stepS62; N), the target pixel is not an inner edge but is located moreinside than the inner edge, and thus the pixel value deciding unit 54outputs the pixel value G[25] which was decided in step S61. If thetarget pixel is located more inside than the inner edge, the surroundingpixel adjacent to the target pixel is also located at the inner edge ormore inside than the inner edge and thus it is not appropriate toperform thinning and smoothing on the surrounding pixel. Therefore, thepixel value deciding unit 54 mandatorily modifies the change amount ofthe surrounding pixel to dST[pos]=dST[apos]=0 (step S63), andinvalidates thinning and smoothing.

If the pixel values of the three pixels are nearly the same (step S62;Y), the target pixel is an inner edge. The pixel value deciding unit 54determines in which direction among the edge direction pos and theopposite-edge direction apos the thinned and smoothed surrounding pixelis adjacent to the target pixel (step S64).

If the edge direction pos, the change amounts dST[pos] and dSMT[pos]which are input with respect to the surrounding pixel adjacent to thetarget pixel in the edge direction pos meet pos≠0, dST[pos]≠0 anddSMT[pos]≠0 (step S64; Y), the pixel value deciding unit 54 determinesthat the thinned and smoothed surrounding pixel is adjacent to thetarget pixel in the edge direction pos (step S65).

If the opposite-edge direction apos, the change amounts dST[apos] anddSMT[apos] which are input with respect to the surrounding pixeladjacent to the target pixel in the opposite-edge direction apos meetapos≠0, dST[apos]≠0 and dSMT[apos]≠0 (step S64; N, S66; Y), the pixelvalue deciding unit 54 determines that the thinned and smoothedsurrounding pixel is adjacent to the target pixel in the opposite-edgedirection apos (step S67).

If none of the conditions is met (step S66; N), the pixel value decidingunit 54 determines that the thinned and smoothed surrounding pixel isnot adjacent to the target pixel in the edge direction nor in theopposite-edge direction, and outputs the pixel value G[25] of the targetpixel which was decided in step S61.

If it is specified that the thinned and smoothed surrounding pixel isadjacent to the target pixel in the edge direction pos, the pixel valuedeciding unit 54 decides the value which is obtained by adding thechange amount dST[pos] due to thinning and the change amount dSMT[pos]due to smoothing to the pixel value C[pos] of the surrounding pixel asthe pixel value G[pos] of the surrounding pixel of when thinningprocessing and smoothing processing are realized at the same time (stepS68).

It is not natural if the pixel value G[pos] of the surrounding pixelbecomes larger than the pixel value of the foreground due to thinningand smoothing. Therefore, if the decided pixel value G[pos] is largerthan the pixel value C[2pos] of the surrounding pixel which is twopixels away from the target pixel in the edge direction pos (step S69;Y), the pixel value deciding unit 54 modifies the pixel value G[pos] ofthe surrounding pixel to the pixel value C[2pos] of the surroundingpixel which is two pixels away from the target pixel. In addition, thepixel value deciding unit 54 decides the value which is obtained byadding the rest of the pixel value G[pos]−C[2pos] which could not beprocessed in the surrounding pixel to the pixel value C[25] of thetarget pixel as the pixel value G[25] of the target pixel of whenthinning processing and smoothing processing are realized at the sametime (step S70).

In order to also keep the decided pixel value G[25] of the target pixelto be equal to or smaller than the pixel value of the foreground, if thedecided pixel value G[25] of the target pixel is larger than the pixelvalue C[2pos] of the surrounding pixel which is two pixels away in theedge direction (step S71; Y), the pixel value deciding unit 54 furthermodifies the pixel value G[25] of the target pixel to the pixel valueC[apos] of the surrounding pixel which is two pixels away from thetarget pixel (step S72).

On the other hand, if the thinned and smoothed surrounding pixel isspecified to be adjacent to the target pixel in the opposite-edgedirection apos, the pixel value deciding unit 54 decides the value whichis obtained by adding the change amount dST[apos] due to thinningprocessing and the change amount dSMT[apos] due to smoothing processingto the pixel value C[apos] of the surrounding pixel as the pixel valueG[apos] of the surrounding pixel of when thinning processing andsmoothing processing are realized at the same time (step S73).

It is not natural if the pixel value G[apos] of the surrounding pixelbecomes smaller than the pixel value of the background due to thinningand smoothing. Therefore, if the decided pixel value G[apos] is smallerthan the pixel value C[2apos] of the surrounding pixel which is twopixels away from the target pixel in the opposite-edge direction (stepS74; Y), the pixel value deciding unit 54 modifies the pixel valueG[apos] of the surrounding pixel to the pixel value C[2apos] of thesurrounding pixel which is two pixels away from the target pixel. Inaddition, the pixel value deciding unit 54 adds the rest of the pixelvalue G[apos]−C[2apos] which could not be processed in the surroundingpixel to the pixel value C[25] of the target pixel, and decides theobtained value as the pixel value G[25] of the target pixel (step S75).

In order to also keep the decided pixel value G[25] of the target pixelto be equal to or smaller than the pixel value of the background, if thedecided pixel value G[25] of the target pixel is smaller than the pixelvalue C[2apos] of the surrounding pixel which is two pixels away in theopposite-edge direction (step S76; Y), the pixel value deciding unit 54further modifies the pixel value G[25] of the target pixel to the pixelvalue C[2apos] of the surrounding pixel which is two pixels away fromthe target pixel (step S77).

FIG. 19A is an image diagram of processing which is performed by theblending processing unit 5.

When thinning processing and smoothing processing are performed on theimage shown in FIG. 19A, only the thinning is performed on the targetpixels M1, and thus this is classified into case 2. Then, the pixelvalues of the target pixels M1 which are only thinned are output becauseneither thinning nor smoothing is performed on the surrounding pixelsadjacent to the target pixel M1 in the edge direction and in theopposite-edge direction.

On the other hand, the target pixels M2 are smoothed and the surroundingpixels N2 adjacent respectively to the target pixels M2 in the edgedirection are thinned. Therefore, this is classified into case 3. Ineach set of target pixel M2 and surrounding pixel N2, the pixel valueobtained by adding the pixel value of the smoothed target pixel M2 andthe pixel value of the thinned surrounding pixel N2 is distributed tothe target pixel M2 and the surrounding pixel N2 so as to be shifted tothe surrounding pixel N2 whose original pixel value is larger.

Both of smoothing and thinning are performed on the target pixels M3,and neither thinning nor smoothing is performed on the surroundingpixels adjacent respectively to the target pixels M3 in the edgedirection or in the opposite-edge direction. Such case is classifiedinto case 1, and the pixel values of the thinned and smoothed targetpixels M3 are output.

As a result, the straight line is thinned and the oblique line issmoothly stepped by smoothing to realize thinning and smoothing in awell balanced manner as shown in FIG. 19B.

In contrast to such a good processing result obtained by the blendingprocessing unit 5, it is difficult to realize thinning and smoothing atthe same time by a method of switching processing depending on the imagestructure so as to perform thinning processing for a straight lineportion and smoothing processing for an oblique line portion and by amethod of setting the pixel value which was changed at the time ofsmoothing processing to be a smaller value considering that thinningprocessing is to be also performed at the same time.

FIG. 20A shows an original image. FIG. 20B shows a desired image to berealized when thinning processing and smoothing processing are performedat the same time on the original image.

When only the smoothing processing is executed on the original image,pixel values of pixels which are located at the edge of the oblique lineportion are increased to obtain a smooth oblique line as shown in FIG.20C. When only the thinning processing is executed on the originalimage, pixel values of the straight line portion are decreased and thestraight line portion is visually thinned as shown in FIG. 20D.

When both of smoothing processing and thinning processing are performedat the same time, it is expected that the oblique line portion becomessmooth and the pixel values of the edge of the straight line portion isdecreased as the desired image shown in FIG. 20B. However, mereswitching so as to perform smoothing processing for the oblique lineportion and to perform thinning processing for the straight line portiongenerates unexpected steps at the points indicated by the arrows asshown in FIG. 20E, and thus the smooth oblique line cannot be realized.

When the pixel value which was changed at the time of smoothingprocessing is set to be a smaller value considering that thinningprocessing is to be also performed at the same time, the processingresult as shown in FIG. 20F is obtained. Though the result seems to beimproved comparing to the processing result shown in FIG. 20E, a step isgenerated at the point indicated by the arrow and the image quality isdegraded comparing to the desired image and the processing resultobtained by the blending processing unit 5 according to the embodiment(see FIG. 19B).

As described above, according to the embodiment, the image processingapparatus 1 includes the smoothing processing unit 2 to performsmoothing processing on image data, the thinning processing unit 3 toperform thinning processing on the image data, the edge directiondetermination unit 4 to determine the edge direction for each pixel inthe image data and the blending processing unit 5 to decide the pixelvalue of each pixel when the thinning processing and the smoothingprocessing are performed at the same time. The blending processing unit5 uses each pixel value C of a target pixel and a surrounding pixel ofthe target pixel, the change amounts dSMT in pixel value due tosmoothing processing, the change aounts dST in pixel value due tothinning processing and the edge direction pos which is determined withrespect to the target pixel to decide the pixel value G[25] of thetarget pixel of when thinning processing and smoothing processing areperformed at the same time according to the combination of whetherthinning processing is performed on the target pixel or not and whethersmoothing processing is performed on the target pixel or not.

In such way, smoothing processing and thinned processing are performedindependently and the pixel value of the target pixel of when thethinning processing and the smoothing process are performed at the sametime can be decided by using the change amount in pixel value obtainedas a result of each processing. By performing the smoothing processingand the thinning processing independently, processing can be switchedeasily between smoothing processing and thinning processing in the imageprocessing apparatus 1 which realizes the thinning processing and thesmoothing processing at the same time.

In case 1 where the target pixel is thinned and smoothed, the blendingprocessing unit 5 decides the value obtained by adding the change amountdST[25] in pixel value of the target pixel due to thinning processingand the change amount dSMT[25] in pixel value of the target pixel due tosmoothing processing to the original pixel value C[25] of the targetpixel as the pixel value G[25] of the target pixel of when the smoothingprocessing and the thinning processing are realized at the same time.

In case 2 where the target pixel is thinned but not smoothed, theblending processing unit 5 decides the value obtained by adding thechange amount dST[25] in pixel value of the target pixel due to thinningprocessing to the original pixel value C[25] of the target pixel as thepixel value G[25] of the target pixel of when the thinning processingand the smoothing processing are realized at the same time.

In case 2, when a surrounding pixel which is not thinned but is smoothedis adjacent to the target pixel in the edge direction pos or in theopposite-edge direction apos, the blending processing unit 5 decides thevalue obtained by adding the change amount dST[25] in pixel value of thetarget pixel due to thinning processing and the change amount dSMT[P] inpixel value of the surrounding pixel due to smoothing processing to theoriginal pixel value C[25] of the target pixel as the pixel value G[25]of the target pixel when thinning processing and smoothing processingare performed at the same time.

In both cases 1 and 2, when a surrounding pixel which is not thinned norsmoothed is adjacent to the target pixel in the edge direction pos, theblending processing unit 5 modifies the decided pixel value G[25] of thetarget pixel to the original pixel value C[pos] of the surrounding pixelwhich is adjacent to the target pixel in the edge direction pos if thedecided pixel value G[25] of the target pixel is greater than theoriginal pixel value C[pos] of the surrounding pixel which is adjacentto the target pixel in the edge direction pos. When a surrounding pixelwhich is not thinned nor smoothed is adjacent to the target pixel in theopposite-edge direction apos, the blending processing unit 5 modifiesthe decided pixel value G[25] of the target pixel to the original pixelvalue C[apos] of the surrounding pixel which is adjacent to the targetpixel in the opposite-edge direction apos if the decided pixel valueG[25] of the target pixel is smaller than the pixel value C[apos] of thesurrounding pixel which is adjacent to the target pixel in theopposite-edge direction apos.

In case 3 where the target pixel is not thinned but is smoothed, theblending processing unit 5 decide the value obtained by adding thechange amount dSMT[25] in pixel value of the target pixel due tosmoothing processing to the pixel value C[25] of the target pixel as thepixel value G[25] of the target pixel of when thinning processing andsmoothing processing are performed at the same time.

In case 3, when a surrounding pixel which is thinned but not smoothed isadjacent to the target pixel in the edge direction pos or in theopposite-edge direction apos, the blending processing unit 5 decides thepixel value G[P] of the surrounding pixel of when thinning processingand smoothing processing are realized at the same time as well as thepixel value of the target pixel. When the sum of the change amountdSMT[25] in pixel value of the target pixel due to smoothing processingand the change amount dST[P] in pixel value of the surrounding pixel dueto thinning processing is a positive value, the blending processing unit5 decides the original pixel value C[25] of the target pixel as thepixel value G[25] of the target pixel of when thinning processing andsmoothing processing are realized at the same time and decides the valueobtained by adding the change amount dST[P] in pixel value of thesurrounding pixel due to thinning processing and the change amountdSMT[25] in pixel value of the target pixel due to smoothing processingto the original pixel value C[P] of the surrounding pixel as the pixelvalue G[P] of the surrounding pixel of when thinning processing andsmoothing processing are realized at the same time if the original pixelvalue C[25] of the target pixel is larger than the original pixel valueC[25] of the surrounding pixel, and the blending processing unit 5decides the value obtained by adding the change amount dST[P] in pixelvalue of the surrounding pixel due to thinning processing and the changeamount dSMT[25] in pixel value of the target pixel due to smoothingprocessing to the original pixel value C[25] of the target pixel as thepixel value G[25] of the target pixel of when thinning processing andsmoothing processing are realized at the same time and decides theoriginal pixel value C[P] of the surrounding pixel as the pixel valueG[P] of the surrounding pixel of when thinning processing and smoothingprocessing are realized at the same time if the original pixel valueC[25] of the target pixel is smaller than the original pixel value C[P]of the surrounding pixel.

In case 3, when the sum temp of the original pixel value C[25] of thetarget pixel, the original pixel value C[P] of the surrounding pixel,the change amount dSMT[25] in pixel value of the target pixel due tosmoothing processing and the change amount dSMT[P] in pixel value of thesurrounding pixel due to thinning processing is larger than twice thepixel value which is larger among t the original pixel values of thetarget pixel and the surrounding pixel, the blending processing unit 5modifies the decided pixel values G[25] and G[P] of the target pixel andthe surrounding pixel to the pixel value which is larger among theoriginal pixel values of the target pixel and the surrounding pixel.

In case 3, when a surrounding pixel which is not thinned nor smoothed isadjacent to the target pixel in the edge direction pos or in theopposite-edge direction apos, the blending processing unit 5 decides thepixel value of the surrounding pixel of when thinning processing andsmoothing processing are realized at the same time as well as the pixelvalue of the target pixel. When the sum of the change amount dSMT[25] inpixel value of the target pixel due to smoothing processing and thechange amount dST[P] in pixel value of the surrounding pixel due tothinning processing is a negative value, the blending processing unit 5decides the value obtained by adding the change amount dST[P] in pixelvalue of the surrounding pixel due to thinning processing and the changeamount dSMT[25] in pixel value of the target pixel due to smoothingprocessing to the original pixel value C[25] of the target pixel as thepixel value G[25] of the target pixel of when thinning processing andsmoothing processing are realized at the same time and decides theoriginal pixel value C[P] of the surrounding pixel as the pixel valueG[P] of the surrounding pixel of when thinning processing and smoothingprocessing are realized at the same time if the original pixel valueC[25] of the target pixel is larger than the original pixel value C[P]of the surrounding pixel, and the blending processing unit 5 decides theoriginal pixel value C[25] of the target pixel as the pixel value G[25]of the target pixel of when thinning processing and smoothing processingare realized at the same time and decides the value obtained by addingthe change amount dST[P] in pixel value of the surrounding pixel due tothinning processing and the change amount dSMT[25] in pixel value of thetarget pixel due to smoothing processing to the pixel value C[P] of thesurrounding pixel as the pixel value G[P] of the surrounding pixel ofwhen thinning processing and smoothing processing are realized at thesame time if the original pixel value C[25] of the target pixel issmaller than the original pixel value C[P] of the surrounding pixel.

In case 3, when the sum temp of the original pixel value C[25] of thetarget pixel, the original pixel value C[P] of the surrounding pixel,the change amount dST[P] in pixel value of surrounding pixel due tothinning processing and the change amount dSMT[25] in pixel value of thetarget pixel due to smoothing processing is smaller than twice the pixelvalue which is smaller among the original pixel values of the targetpixel and the surrounding pixel, the blending processing unit 5 modifiesthe decided pixel values G[25] and G[P] of the target pixel and thesurrounding pixel to the pixel value which is smaller among the originalpixel values of the target pixel and the surrounding pixel.

In case 4 where the target pixel is not thinned nor smoothed, theblending processing unit 5 decides the original pixel value C[25] of thetarget pixel as the pixel value G[25] of the target pixel of whenthinning processing and smoothing processing are realized at the sametime if the pixel value C[pos] of the surrounding pixel which isadjacent to the target pixel in the edge direction pos and the pixelvalue C[apos] of the surrounding pixel which is adjacent to the targetpixel in the opposite-edge direction apos are nearly the same as thepixel value C[25] of the target pixel.

In case 4, when the pixel value C[pos] of the surrounding pixel which isadjacent to the target pixe in the edge direction pos and the pixelvalue C[apos] of the surrounding pixel which is adjacent to the targetpixel in the opposite-edge direction apos are not nearly the same as thepixel value C[25] of the target pixel and a thinned and smoothedsurrounding pixel is adjacent to the target pixel in the edge directionpos, the blending processing unit 5 decides the pixel value of thesurrounding pixel of when thinning processing and smoothing processingare realized at the same time as well as the pixel value of the targetpixel. The blending processing unit 5 decides the original pixel valueC[25] of the pixel value as the pixel value G[25] of the target pixel ofthen thinning processing and smoothing processing are realized at thesame time and decides the value obtained by adding the change amountdST[pos] in pixel value of the surrounding pixel due to thinningprocessing and the change amount dSMT[pos] in pixel value of thesurrounding pixel due to smoothing processing to the original pixelvalue C[pos] of the surrounding pixel as the pixel value G[pos] of thesurrounding pixel of when thinning processing and smoothing processingare realized at the same time.

In case 4, when the decided pixel value G[pos] of the surrounding pixelis larger than the pixel value C[2pos] of the surrounding pixel which istwo pixels away from the target pixel in the edge direction pos, theblending processing unit 5 modifies the decided pixel value G[pos] ofthe surrounding pixel to the pixel value C[2pos] of the surroundingpixel which is two pixels away from the target pixel in the edgedirection and modifies the decided pixel value G[25] of the target pixelto the value obtained by adding the value which is obtained bysubtracting the pixel value C[2pos] of the surrounding pixel which istwo pixels away from the target pixel in the edge direction pos from thedecided pixel value G[pos] of the surrounding pixel to the originalpixel value C[25] of the target pixel. When the modified pixel valueG[25] is larger than the pixel value C[2pos] of the surrounding pixel(first surrounding pixel) two pixels away in the edge direction pos, thepixel value G[25] is further modified to the pixel value C[2pos] ofsurrounding pixel (second surrounding pixel) two pixels away in the edgedirection.

In case 4, when the pixel value C[pos] of the surrounding pixel which isadjacent to the pixel value in the edge direction pos and the pixelvalue C[apos] of the surrounding pixel which is adjacent to the targetpixel in the opposite-edge direction apos are not nearly the same as thepixel value of the target pixel and a thinned and smoothed surroundingpixel is adjacent to the target pixel in the opposite-edge directionapos, the blending processing unit 5 decides the pixel value of thesurrounding pixel of when thinning processing and smoothing processingare realized at the same time as well as the pixel value to the targetpixel. The blending processing unit 5 decides the original pixel valueC[25] of the target pixel as the pixel value G[25] of the target pixelof when thinning processing and smoothing processing are realized at thesame time and decides the value obtained by adding the change amountdST[pos] in pixel value of the surrounding pixel due to thinningprocessing and the change amount dSMT[pos] in pixel value of thesurrounding pixel due to smoothing processing to the original pixelvalue C[apos] of the surrounding pixel as the pixel value G[apos] of thesurrounding pixel of when thinning processing and smoothing processingare realized at the same time.

In case 4, when the decided pixel value G[apos] of the surrounding pixelis smaller than the pixel value C[2apos] of the surrounding pixel whichis two pixels away from the target pixel in the opposite-edge directionapos, the blending processing unit 5 modifies the decided pixel valueG[pos] of the surrounding pixel to the pixel value C[2apos] of thesurrounding pixel which is two pixels away in the opposite-edgedirection apos and modifies the decided pixel value C[25] of the targetpixel to the value obtained by adding the value which is obtained bysubtracting the pixel value C[2apos] of the surrounding pixel which istwo pixels away in the opposite-edge direction apos from the decidedpixel value G[apos] of the surrounding pixel to the original pixel valueC[25] of the target pixel. When the modified pixel value G[25] issmaller than the pixel value C[2apos] of the surrounding pixel (firstsurrounding pixel) two pixels away in the opposite-edge direction apos,the blending processing unit 5 further modifies the pixel value G[25] tothe pixel value C[2apos] of the surrounding pixel (second surroundingpixel) two pixels away in the opposite-edge direction apos.

In such way, pixel values can be adjusted in two pixels, which are atarget pixel and a surrounding pixel, according to whether thinning andsmoothing are performed or not on the surrounding pixel which isadjacent to the target pixel, and the thinning and smoothing can berealized in a well balanced manner. Further, because modifications inpixel values are carried out by taking the densities of foreground andbackground into consideration, the foreground and background can bereproduced naturally even after the thinning and smoothing.

Here the above described embodiment is a preferred embodiment of thepresent invention, and the present invention is not limited to this.

For example, the processing methods of thinning processing and smoothingprocessing are not limited to the above described processing methods,and can be any other processing method as long as the change amounts inpixel value due to thinning processing and the change amounts in pixelvalue due to smoothing processing are output.

Further, the thinning processing unit 3 and the smoothing processingunit 2 calculates the change amounts dST and dSMT, respectively, to beused by the blending processing unit 5. However, pixel values of afterprocessing can be output from the smoothing processing unit 2 and thethinning processing unit 3 so that the blending processing unit 5 cancalculate the change amounts dST and dSMT by subtracting the originalpixel value from the pixel value after processing.

Moreover, the processing contents of each unit such as the blendingprocessing unit may be programmed and software processing may beperformed by cooperation between su program and CPU and the like. Then,as a computer readable medium of the program, a non-volatile memory suchas ROM and a flash memory and a portable recording medium such as CD-ROMand be used. Also, as a medium for providing program data via acommunication line, carrier wave is also used in the present invention.

According to one aspect of the present invention an image processingapparatus includes a smoothing processing unit which performs smoothingprocessing on image data, a thinning processing unit which performsthinning processing on the image data, an edge direction determinationunit which determines an edge direction with respect to each pixel ofthe image data and a blending processing unit which decides a pixelvalue of each pixel of when the thinning processing and the smoothingprocessing are realized at same time, and the blending processing unitdecides a pixel value of a target pixel of when the thinning processingand the smoothing processing are realized at the same time depending ona combination of whether the thinning processing is performed or not andwhether the smoothing processing is performed or not on the target pixelby using pixel values of the target pixel and a surrounding pixel of thetarget pixel, change amounts in pixel value due to the smoothingprocessing, change amounts in pixel value due to the thinning processingand the edge direction which is determined with respect to the targetpixel.

According to the present invention, the smoothing processing and thethinning processing are performed independently and the pixel value ofthe target pixel of when the thinning processing and the smoothingprocessing are realized at the same time can be decided by using thechange amounts in pixel values obtained as processing results of the twoprocessing. By performing the smoothing processing and the thinningprocessing independently, switching between processing of the smoothingprocessing and the thinning processing can be carried out easily in theimage processing apparatus which realizes the thinning processing andthe smoothing processing as the same time.

Preferably, when the target pixel is thinned and smoothed, the blendingprocessing unit decides a value obtained by adding a change amount inpixel value of the target pixel due to the thinning processing and achange amount in pixel value of the target pixel due to the smoothingprocessing to an original pixel value of the target pixel as a pixelvalue of the target pixel of when the thinning processing and thesmoothing processing are realized at the same time.

Preferably, when the target pixel is thinned but not smoothed, theblending processing unit decides a value obtained by adding a changevalue in pixel value of the target pixel due to the thinning processingto an original pixel value of the target pixel as a pixel value of thetarget pixel of when the thinning processing and the smoothingprocessing are realized at the same time.

Preferably, when a surrounding pixel which is not thinned but issmoothed is adjacent to the target pixel in the edge direction or anopposite-edge direction, the blending processing unit decides a valueobtained by adding the change amount in pixel value of the target pixeldue to the thinning processing and a change amount in pixel value of thesurrounding pixel due to the smoothing processing to the original pixelvalue of the target pixel as a pixel value of when the thinningprocessing and the smoothing processing are realized at the same time.

Preferably, the blending processing unit (1) modifies the decided pixelvalue of the target pixel to an original pixel value of a surroundingpixel which is adjacent to the edge direction when the decided pixelvalue of the target pixel is larger than the original pixel value of thesurrounding pixel which is adjacent to the target pixel in the edgedirection and (2) modifies the decided pixel value of the target pixelto an original pixel value of a surrounding pixel which is adjacent tothe target pixel in an opposite-edge direction when the decided pixelvalue of the target pixel is smaller than the original pixel value ofthe surrounding pixel which is adjacent to the target pixel in theopposite-edge direction.

Preferably, when the target pixel is not thinned but is smoothed, theblending processing unit decides a value obtained by adding a changeamount in pixel value of the target pixel due to the smoothingprocessing to an original pixel value of the target pixel as a pixelvalue of the target pixel of when the thinning processing and thesmoothing processing are realized at the same time.

Preferably, when a surrounding pixel which is thinned but not smoothedis adjacent to the target pixel in the edge direction or anopposite-edge direction, the blending processing unit decides a pixelvalue of the surrounding pixel of when the thinning processing and thesmoothing processing are realized at the same time as well as the pixelvalue of the target pixel, when a sum of the change amount in pixelvalue of the target pixel due to the smoothing processing and a changeamount in pixel value of the surrounding pixel due to the thinningprocessing is a positive value, the blending processing unit (1) decidesthe original pixel value of the target pixel as the pixel value of thetarget pixel of when the thinning processing and the smoothingprocessing are realized at the same time and decides a value obtained byadding a change amount in pixel value of the surrounding pixel due tothe thinning processing and the change amount in pixel value of thetarget pixel due to the smoothing processing to an original pixel valueof the surrounding pixel as the pixel value of the surrounding pixel ofwhen the thinning processing and the smoothing processing are realizedat the same time when the original pixel value of the target pixel islarger than the original pixel value of the surrounding pixel, and (2)decides a value obtained by adding the change amount in pixel value ofthe surrounding pixel due to the thinning processing and the changeamount in pixel value of the target pixel due to the smoothingprocessing to the original pixel value of the target pixel as the pixelvalue of the target pixel of when the thinning processing and thesmoothing processing are realized at the same time and decides theoriginal pixel value of the surrounding pixel as the pixel value of thesurrounding pixel of when the thinning processing and the smoothingprocessing are realized at the same time when the original pixel valueof the target pixel is smaller than the original pixel value of thesurrounding pixel.

Preferably, when a sum of the original pixel value of the target pixel,the original pixel value of the surrounding pixel, the change amount inpixel value of the target pixel due to the smoothing processing and thechange amount in pixel value of the surrounding pixel due to thethinning processing is larger than twice a pixel value which is largeramong the original pixel values of the target pixel and the surroundingpixel, the blending processing unit modifies the decided pixel values ofthe target pixel and the surrounding pixel to the pixel value which islarger among the original pixel values of the target pixel and thesurrounding pixel.

Preferably, when a surrounding pixel which is thinned but not smoothedis adjacent to the target pixel in the edge direction or in anopposite-edge direction, the blending processing unit decides a pixelvalue of the surrounding pixel of when the thinning processing and thesmoothing processing are realized at the same time as well as the pixelvalue of the target pixel, when a sum of the change amount in pixelvalue of the target pixel due to the smoothing processing and a changeamount in pixel value of the surrounding pixel due to the thinningprocessing is a negative value, the blending processing unit (1) decidesa value obtained by adding a change amount in pixel value of thesurrounding pixel due to the thinning processing and the change amountin pixel value of the target pixel due to the smoothing processing tothe original pixel value of the target pixel as the pixel value of thetarget pixel of when the thinning processing and the smoothingprocessing are realized at the same time and decides an original pixelvalue of the surrounding pixel as the pixel value of the surroundingpixel of when the thinning processing and the smoothing processing arerealized at the same time when the original pixel value of the targetpixel is larger than the original pixel value of the surrounding pixel,and (2) decides the original pixel value of the target pixel as thepixel value of the target pixel of when the thinning processing and thesmoothing processing are realized at the same time and decides a valueobtained by adding the change amount in pixel value of the surroundingpixel due to the thinning processing and the change amount in pixelvalue of the target pixel due to the smoothing processing to theoriginal pixel value of the surrounding pixel as the pixel value of thesurrounding pixel of when the thinning processing and the smoothingprocessing are realized at the same time when the original pixel valueof the target pixel is smaller than the original pixel value of thesurrounding pixel.

Preferably, when a sum of the original pixel value of the target pixel,the original pixel value of the surrounding pixel, the change amount inpixel value of the surrounding pixel due to the thinning processing andthe change amount in pixel value of the target pixel due to thesmoothing processing is smaller than twice a pixel value which issmaller among the original pixel values of the target pixel and thesurrounding pixel, the blending processing unit modifies the decidedpixel values of the target pixel and the surrounding pixel to the pixelvalue which is smaller among the original pixel values of the targetpixel and the surrounding pixel.

Preferably, when the target pixel is not thinned nor smoothed, theblending processing unit decides an original pixel value of the targetpixel as the pixel value of the target pixel of when the thinningprocessing and the smoothing processing are realized at the same time ifa pixel value of the surrounding pixel which is adjacent to the targetpixel in the edge direction and a pixel value of the surrounding pixelwhich is adjacent to the target pixel in an opposite-edge direction arenearly same as the pixel value to the target pixel.

Preferably, when the pixel values of the target pixel and thesurrounding pixels which are adjacent to the target pixel in the edgedirection and the opposite-edge direction are not approximately same anda surrounding pixel which is thinned and smoothed is adjacent to thetarget pixel in the edge direction, the blending processing unit decidesthe pixel value of the surrounding pixel of when the thinning processingand the smoothing processing are realized at the same time as well asthe pixel value of the target pixel, and the blending processing unit(1) decides the original pixel value of the target pixel as the pixelvalue of the target pixel of when the thinning processing and thesmoothing processing are realized at the same time and (2) decides avalue obtained by adding a change amount in pixel value of thesurrounding pixel due to the thinning processing and a change amount inpixel value of the surrounding pixel due to the smoothing processing toan original pixel value of the surrounding pixel as the pixel value ofthe surrounding pixel of when the thinning processing and the smoothingprocessing are realized at the same time.

Preferably, when the decided pixel value of the surrounding pixel islarger than a pixel value of a first surrounding pixel two pixels awayfrom the target pixel in the edge direction, the blending processingunit (1) modifies the decided pixel value of the surrounding pixel tothe pixel value of the first surrounding pixel two pixels away from thetarget pixel in the edge direction and (2) modifies the decided pixelvalue of the target pixel to a value obtained by adding a value which isobtained by subtracting the pixel value of the first surrounding pixeltwo pixels away in the edge direction from the decided pixel value ofthe surrounding pixel to the original pixel value of the target pixeland further modifies to a pixel value of a second surrounding pixel twopixels away in the edge direction when the modified pixel value islarger than the pixel value of the first surrounding pixel two pixelsaway in the edge direction.

Preferably, when the pixel values of the target pixel and thesurrounding pixels which are adjacent to the target pixel in the edgedirection and the opposite-edge direction are not approximately same anda surrounding pixel which is thinned and smoothed is adjacent to thetarget pixel in the opposite-edge direction, the blending processingunit decides the pixel value of the surrounding pixel of when thethinning processing and the smoothing processing are realized at thesame time as well as the pixel value of the target pixel, and theblending processing unit (1) decides the original pixel value of thetarget pixel as the pixel value of the target pixel of which thethinning processing and the smoothing processing are realized at thesame time and (2) decides a value obtained by adding a change amount inpixel value of the surrounding pixel due to the thinning processing anda change amount in pixel value of the surrounding pixel due to thesmoothing processing to an original pixel value of the surrounding pixelas the pixel value of the surrounding pixel of when the thinningprocessing and the smoothing processing are realized at the same time.

Preferably, when the decided pixel value of the surrounding pixel issmaller than a pixel value of a first surrounding pixel two pixels awayfrom the target pixel in the edge direction, the blending processing (1)modifies the decided pixel value of the surrounding pixel to the pixelvalue of the first surrounding pixel two pixels away in theopposite-edge direction and (2) modifies the decided pixel value of thetarget pixel to a value which is obtained by adding a value which isobtained by subtraction the pixel value of the first surrounding pixeltwo pixels away in the edge direction from the decided pixel value ofthe surrounding pixel to the original pixel value of the target pixel,and further modifies the modified pixel value to a pixel value of asecond surrounding pixel two pixels away in the opposite-edge directionwhen the modified pixel value is smaller than the pixel value of thefirst surrounding pixel two pixels away in the opposite-edge direction.

According the other aspect of the present invention, an image processingmethod includes smoothing of image data, thinning of the image data,determining an edge direction with respect to each pixel of the imagedata and blending to decide a pixel value of each pixel of when thethinning processing and the smoothing processing are realized at sametime, and in the blending, a pixel value of a target pixel of when thethinning processing and the smoothing processing are realized at thesame time is decided depending on a combination of whether the thinningprocessing is performed or not and whether the smoothing processing isperformed or not on the target pixel by using pixel values of the targetpixel and a surrounding pixel of the target pixel, change amounts inpixel value due to the smoothing processing, change amounts in pixelvalue due to the thinning processing and the edge direction which isdetermined with respect to the target pixel.

According to the present invention, the smoothing processing and thethinning processing are performed independently and the pixel value ofthe target pixel of when the thinning processing and the smoothingprocessing are realized at the same time can be decided by using thechange amounts in pixel values obtained as processing results of the twoprocessing. By performing the smoothing processing and the thinningprocessing independently, switching between processing of the smoothingprocessing and the thinning processing can be carried out easily in theimage processing apparatus which realizes the thinning processing andthe smoothing processing as the same time.

Preferably, when the target pixel is thinned and smoothed, a valueobtained by adding a change amount in pixel value of the target pixeldue to the thinning processing and a change amount in pixel value of thetarget pixel due to the smoothing processing to an original pixel valueof the target pixel is decided as a pixel value of the target pixel ofwhen the thinning processing and the smoothing processing are realizedat the same time in the blending.

Preferably, when the target pixel is thinned but not smoothed, a valueobtained by adding a change value in pixel value of the target pixel dueto the thinning processing to an original pixel value of the targetpixel is decided as a pixel value of the target pixel of when thethinning processing and the smoothing processing are realized at thesame time in the blending.

Preferably, when the target pixel is not thinned but is smoothed, avalue obtained by adding a change amount in pixel value of the targetpixel due to the smoothing processing to an original pixel value of thetarget pixel is decided as a pixel value of the target pixel of when thethinning processing and the smoothing processing are realized at thesame time in the blending.

Preferably, when the target pixel is not thinned nor smoothed, anoriginal pixel value of the target pixel is decided as a pixel value ofthe target pixel of when the thinning processing and the smoothingprocessing are realized at the same time in the blending if a pixelvalue of a surrounding pixel which is adjacent to the target pixel inthe edge direction and a pixel value of a surrounding pixel which isadjacent to the target pixel in an opposite-edge direction areapproximately same as the pixel value of the target pixel.

The entire disclosure of Japanese Patent Application No. 2011-143682filed on Jun. 29, 2011 including description, claims, drawings, andabstract are incorporated herein by reference in its entirety.

What is claimed is:
 1. An image processing apparatus comprising a CPUoperable as units comprising: a smoothing processing unit which performssmoothing processing on image data; a thinning processing unit whichperforms thinning processing on the image data; an edge directiondetermination unit which determines an edge direction with respect toeach pixel of the image data; and a blending processing unit whichdecides a pixel value of each pixel when the thinning processing and thesmoothing processing are realized at a same time, wherein the blendingprocessing unit decides a pixel value of a target pixel when thethinning processing and the smoothing processing are realized at thesame time based on a combination of whether the thinning processing isperformed or not and whether the smoothing processing is performed ornot on the target pixel by using pixel values of the target pixel and asurrounding pixel of the target pixel, change amounts in pixel value dueto the smoothing processing, change amounts in pixel value due to thethinning processing, and the edge direction which is determined withrespect to the target pixel, wherein when the target pixel is notthinned nor smoothed, the blending processing unit decides an originalpixel value of the target pixel as the pixel value of the target pixelwhen the thinning processing and the smoothing processing are realizedat the same time if a pixel value of the surrounding pixel which isadjacent to the target pixel in the edge direction and a pixel value ofthe surrounding pixel which is adjacent to the target pixel in anopposite-edge direction are nearly the same as the pixel value of thetarget pixel, wherein when the pixel values of the target pixel and thesurrounding pixels which are adjacent to the target pixel in the edgedirection and the opposite-edge direction are not approximately the sameand a surrounding pixel which is thinned and smoothed is adjacent to thetarget pixel in the edge direction, the blending processing unit decidesthe pixel value of the surrounding pixel when the thinning processingand the smoothing processing are realized at the same time as well asthe pixel value of the target pixel, and wherein the blending processingunit (1) decides the original pixel value of the target pixel as thepixel value of the target pixel when the thinning processing and thesmoothing processing are realized at the same time and (2) decides avalue obtained by adding a change amount in pixel value of thesurrounding pixel due to the thinning processing and a change amount inpixel value of the surrounding pixel due to the smoothing processing toan original pixel value of the surrounding pixel as the pixel value ofthe surrounding pixel when the thinning processing and the smoothingprocessing are realized at the same time.
 2. The image processingapparatus according to claim 1, wherein when the decided pixel value ofthe surrounding pixel is larger than a pixel value of a firstsurrounding pixel two pixels away from the target pixel in the edgedirection, the blending processing unit: (1) modifies the decided pixelvalue of the surrounding pixel to the pixel value of the firstsurrounding pixel two pixels away from the target pixel in the edgedirection and (2) modifies the decided pixel value of the target pixelto a value obtained by adding a value which is obtained by subtractingthe pixel value of the first surrounding pixel two pixels away in theedge direction from the decided pixel value of the surrounding pixel tothe original pixel value of the target pixel and further modifies to apixel value of a second surrounding pixel two pixels away in the edgedirection when the modified pixel value is larger than the pixel valueof the first surrounding pixel two pixels away in the edge direction. 3.The image processing apparatus according to claim 2, wherein when thedecided pixel value of the surrounding pixel is smaller than a pixelvalue of a first surrounding pixel two pixels away from the target pixelin the edge direction, the blending processing: (1) modifies the decidedpixel value of the surrounding pixel to the pixel value of the firstsurrounding pixel two pixels away in the opposite-edge direction and (2)modifies the decided pixel value of the target pixel to a value which isobtained by adding a value which is obtained by subtracting the pixelvalue of the first surrounding pixel two pixels away in the edgedirection from the decided pixel value of the surrounding pixel to theoriginal pixel value of the target pixel, and further modifies themodified pixel value to a pixel value of a second surrounding pixel twopixels away in the opposite-edge direction when the modified pixel valueis smaller than the pixel value of the first surrounding pixel twopixels away in the opposite-edge direction.
 4. An image processingapparatus comprising a CPU operable as units comprising: a smoothingprocessing unit which performs smoothing processing on image data; athinning processing unit which performs thinning processing on the imagedata; an edge direction determination unit which determines an edgedirection with respect to each pixel of the image data; and a blendingprocessing unit which decides a pixel value of each pixel when thethinning processing and the smoothing processing are realized at a sametime, wherein the blending processing unit decides a pixel value of atarget pixel when the thinning processing and the smoothing processingare realized at the same time based on a combination of whether thethinning processing is performed or not and whether the smoothingprocessing is performed or not on the target pixel by using pixel valuesof the target pixel and a surrounding pixel of the target pixel, changeamounts in pixel value due to the smoothing processing, change amountsin pixel value due to the thinning processing, and the edge directionwhich is determined with respect to the target pixel, wherein when thetarget pixel is thinned but not smoothed, the blending processing unitdecides a value obtained by adding a change value in pixel value of thetarget pixel due to the thinning processing to an original pixel valueof the target pixel as a pixel value of the target pixel when thethinning processing and the smoothing processing are realized at thesame time, and wherein when a surrounding pixel which is not thinned butis smoothed is adjacent to the target pixel in the edge direction or anopposite-edge direction, the blending processing unit decides a valueobtained by adding the change amount in pixel value of the target pixeldue to the thinning processing and a change amount in pixel value of thesurrounding pixel due to the smoothing processing to the original pixelvalue of the target pixel as a pixel value when the thinning processingand the smoothing processing are realized at the same time.
 5. An imageprocessing apparatus comprising a CPU operable as units comprising: asmoothing processing unit which performs smoothing processing on imagedata; a thinning processing unit which performs thinning processing onthe image data; an edge direction determination unit which determines anedge direction with respect to each pixel of the image data; and ablending processing unit which decides a pixel value of each pixel whenthe thinning processing and the smoothing processing are realized at asame time, wherein the blending processing unit decides a pixel value ofa target pixel when the thinning processing and the smoothing processingare realized at the same time based on a combination of whether thethinning processing is performed or not and whether the smoothingprocessing is performed or not on the target pixel by using pixel valuesof the target pixel and a surrounding pixel of the target pixel, changeamounts in pixel value due to the smoothing processing, change amountsin pixel value due to the thinning processing, and the edge directionwhich is determined with respect to the target pixel, wherein when thetarget pixel is thinned and smoothed, the blending processing unitdecides a value obtained by adding a change amount in pixel value of thetarget pixel due to the thinning processing and a change amount in pixelvalue of the target pixel due to the smoothing processing to an originalpixel value of the target pixel as a pixel value of the target pixelwhen the thinning processing and the smoothing processing are realizedat the same time, and wherein the blending processing unit (1) modifiesthe decided pixel value of the target pixel to an original pixel valueof a surrounding pixel which is adjacent to the edge direction when thedecided pixel value of the target pixel is larger than the originalpixel value of the surrounding pixel which is adjacent to the targetpixel in the edge direction and (2) modifies the decided pixel value ofthe target pixel to an original pixel value of a surrounding pixel whichis adjacent to the target pixel in an opposite-edge direction when thedecided pixel value of the target pixel is smaller than the originalpixel value of the surrounding pixel which is adjacent to the targetpixel in the opposite-edge direction.
 6. An image processing apparatuscomprising a CPU operable as units comprising: a smoothing processingunit which performs smoothing processing on image data; a thinningprocessing unit which performs thinning processing on the image data; anedge direction determination unit which determines an edge directionwith respect to each pixel of the image data; and a blending processingunit which decides a pixel value of each pixel when the thinningprocessing and the smoothing processing are realized at a same time,wherein the blending processing unit decides a pixel value of a targetpixel when the thinning processing and the smoothing processing arerealized at the same time based on a combination of whether the thinningprocessing is performed or not and whether the smoothing processing isperformed or not on the target pixel by using pixel values of the targetpixel and a surrounding pixel of the target pixel, change amounts inpixel value due to the smoothing processing, change amounts in pixelvalue due to the thinning processing, and the edge direction which isdetermined with respect to the target pixel, wherein when the targetpixel is not thinned but is smoothed, the blending processing unitdecides a value obtained by adding a change amount in pixel value of thetarget pixel due to the smoothing processing to an original pixel valueof the target pixel as a pixel value of the target pixel when thethinning processing and the smoothing processing are realized at thesame time, wherein when a surrounding pixel which is thinned but notsmoothed is adjacent to the target pixel in the edge direction or anopposite-edge direction, the blending processing unit decides a pixelvalue of the surrounding pixel when the thinning processing and thesmoothing processing are realized at the same time as well as the pixelvalue of the target pixel, and wherein when a sum of the change amountin pixel value of the target pixel due to the smoothing processing and achange amount in pixel value of the surrounding pixel due to thethinning processing is a positive value, the blending processing unit:(1) decides the original pixel value of the target pixel as the pixelvalue of the target pixel when the thinning processing and the smoothingprocessing are realized at the same time and decides a value obtained byadding a change amount in pixel value of the surrounding pixel due tothe thinning processing and the change amount in pixel value of thetarget pixel due to the smoothing processing to an original pixel valueof the surrounding pixel as the pixel value of the surrounding pixelwhen the thinning processing and the smoothing processing are realizedat the same time when the original pixel value of the target pixel islarger than the original pixel value of the surrounding pixel, and (2)decides a value obtained by adding the change amount in pixel value ofthe surrounding pixel due to the thinning processing and the changeamount in pixel value of the target pixel due to the smoothingprocessing to the original pixel value of the target pixel as the pixelvalue of the target pixel when the thinning processing and the smoothingprocessing are realized at the same time and decides the original pixelvalue of the surrounding pixel as the pixel value of the surroundingpixel when the thinning processing and the smoothing processing arerealized at the same time when the original pixel value of the targetpixel is smaller than the original pixel value of the surrounding pixel.7. The image processing apparatus according to claim 6, wherein when asum of the original pixel value of the target pixel, the original pixelvalue of the surrounding pixel, the change amount in pixel value of thetarget pixel due to the smoothing processing and the change amount inpixel value of the surrounding pixel due to the thinning processing islarger than twice a pixel value which is larger among the original pixelvalues of the target pixel and the surrounding pixel, the blendingprocessing unit modifies the decided pixel values of the target pixeland the surrounding pixel to the pixel value which is larger among theoriginal pixel values of the target pixel and the surrounding pixel. 8.An image processing apparatus comprising a CPU operable as unitscomprising: a smoothing processing unit which performs smoothingprocessing on image data; a thinning processing unit which performsthinning processing on the image data; an edge direction determinationunit which determines an edge direction with respect to each pixel ofthe image data; and a blending processing unit which decides a pixelvalue of each pixel when the thinning processing and the smoothingprocessing are realized at a same time, wherein the blending processingunit decides a pixel value of a target pixel when the thinningprocessing and the smoothing processing are realized at the same timebased on a combination of whether the thinning processing is performedor not and whether the smoothing processing is performed or not on thetarget pixel by using pixel values of the target pixel and a surroundingpixel of the target pixel, change amounts in pixel value due to thesmoothing processing, change amounts in pixel value due to the thinningprocessing, and the edge direction which is determined with respect tothe target pixel, wherein when the target pixel is not thinned but issmoothed, the blending processing unit decides a value obtained byadding a change amount in pixel value of the target pixel due to thesmoothing processing to an original pixel value of the target pixel as apixel value of the target pixel when the thinning processing and thesmoothing processing are realized at the same time, wherein when asurrounding pixel which is thinned but not smoothed is adjacent to thetarget pixel in the edge direction or in an opposite-edge direction, theblending processing unit decides a pixel value of the surrounding pixelwhen the thinning processing and the smoothing processing are realizedat the same time as well as the pixel value of the target pixel, andwherein when a sum of the change amount in pixel value of the targetpixel due to the smoothing processing and a change amount in pixel valueof the surrounding pixel due to the thinning processing is a negativevalue, the blending processing unit: (1) decides a value obtained byadding a change amount in pixel value of the surrounding pixel due tothe thinning processing and the change amount in pixel value of thetarget pixel due to the smoothing processing to the original pixel valueof the target pixel as the pixel value of the target pixel when thethinning processing and the smoothing processing are realized at thesame time and decides an original pixel value of the surrounding pixelas the pixel value of the surrounding pixel when the thinning processingand the smoothing processing are realized at the same time when theoriginal pixel value of the target pixel is larger than the originalpixel value of the surrounding pixel, and (2) decides the original pixelvalue of the target pixel as the pixel value of the target pixel whenthe thinning processing and the smoothing processing are realized at thesame time and decides a value obtained by adding the change amount inpixel value of the surrounding pixel due to the thinning processing andthe change amount in pixel value of the target pixel due to thesmoothing processing to the original pixel value of the surroundingpixel as the pixel value of the surrounding pixel when the thinningprocessing and the smoothing processing are realized at the same timewhen the original pixel value of the target pixel is smaller than theoriginal pixel value of the surrounding pixel.
 9. The image processingapparatus according to claim 8, wherein when a sum of the original pixelvalue of the target pixel, the original pixel value of the surroundingpixel, the change amount in pixel value of the surrounding pixel due tothe thinning processing and the change amount in pixel value of thetarget pixel due to the smoothing processing is smaller than twice apixel value which is smaller among the original pixel values of thetarget pixel and the surrounding pixel, the blending processing unitmodifies the decided pixel values of the target pixel and thesurrounding pixel to the pixel value which is smaller among the originalpixel values of the target pixel and the surrounding pixel.
 10. An imageprocessing apparatus comprising a CPU operable as units comprising: asmoothing processing unit which performs smoothing processing on imagedata; a thinning processing unit which performs thinning processing onthe image data; an edge direction determination unit which determines anedge direction with respect to each pixel of the image data; and ablending processing unit which decides a pixel value of each pixel whenthe thinning processing and the smoothing processing are realized at asame time, wherein the blending processing unit decides a pixel value ofa target pixel when the thinning processing and the smoothing processingare realized at the same time based on a combination of whether thethinning processing is performed or not and whether the smoothingprocessing is performed or not on the target pixel by using pixel valuesof the target pixel and a surrounding pixel of the target pixel, changeamounts in pixel value due to the smoothing processing, change amountsin pixel value due to the thinning processing, and the edge directionwhich is determined with respect to the target pixel, wherein when thetarget pixel is not thinned nor smoothed, the blending processing unitdecides an original pixel value of the target pixel as the pixel valueof the target pixel when the thinning processing and the smoothingprocessing are realized at the same time if a pixel value of thesurrounding pixel which is adjacent to the target pixel in the edgedirection and a pixel value of the surrounding pixel which is adjacentto the target pixel in an opposite-edge direction are nearly the same asthe pixel value of the target pixel, wherein when the pixel values ofthe target pixel and the surrounding pixels which are adjacent to thetarget pixel in the edge direction and the opposite-edge direction arenot approximately the same and a surrounding pixel which is thinned andsmoothed is adjacent to the target pixel in the opposite-edge direction,the blending processing unit decides the pixel value of the surroundingpixel when the thinning processing and the smoothing processing arerealized at the same time as well as the pixel value of the targetpixel, and wherein the blending processing unit (1) decides the originalpixel value of the target pixel as the pixel value of the target pixelof which the thinning processing and the smoothing processing arerealized at the same time and (2) decides a value obtained by adding achange amount in pixel value of the surrounding pixel due to thethinning processing and a change amount in pixel value of thesurrounding pixel due to the smoothing processing to an original pixelvalue of the surrounding pixel as the pixel value of the surroundingpixel when the thinning processing and the smoothing processing arerealized at the same time.